/** @file CameraObject.h
    @class CameraObject
    @brief This class represents a camera support. It does actually not attach a camera to a scene node, but it provides a node where a camera can be attached, and provides all the logic for moving the camera.
*/
#ifndef _CameraObject_h_
#define _CameraObject_h_

#include "stdafx.h"
#include "GameObject.h"
class CameraObject : public GameObject {
public:
	/**
	*	@brief Constructor
	*/
	CameraObject ();

	/**
	*	@brief Destructor
	*/
	~CameraObject ();

	/**
	*	@brief Apply logic updates that needs to be handeled every game loop. There is no such logic in this class.
	*/
	void updateLogic();

	/**
	*	@brief Inherited from GameObject to add visible components to the object. Since the camera object does not have any visible component, this method does nothing.
	*	@param sceneMgr	The Ogre::SceneManager that manages the scene where the box should be placed.
	*	@param id	A unique id, not shared with any other movable object in the scene.
	*/
	virtual void createMovableObject(Ogre::SceneManager* sceneMgr, unsigned int id);

	/**
	*	@brief The camera object makes use of four scene nodes. This method sets the root node of the camera, and creates three	ancestor nodes to it: yaw (child), pitch (grandchild) and roll (great grandchild). The camera itself will			
	*	@param node		The scene node that the camera should be attached to.
	*/
	virtual void setSceneNode(Ogre::SceneNode* node);

	/**
	*	@brief Returns the scene node that a camera can be attached to. This is the same node that is used to perform a roll of the camera.
	*/
	virtual Ogre::SceneNode* getCameraNode();
	
	/**
	*	@brief Translates the camera position relative to it's current position.
	*	@param x The desired movement in x-direction.
	*	@param y The desired movement in y-direction.
	*	@param z The desired movement in z-direction.
	*/
	virtual void move(float x, float y, float z);

	/**
	*	@brief Rotates the camera so that it looks to the left or to the right (yaw).
	*	@param x The number of degrees to turn the camera.
	*/
	void turn(float amount);

	/**
	*	@brief Rotates the camera so that it follows the mouse movements.
	*	@param mouseRotX	Relative mouse movement in x-direction. 
	*	@param mouseRotY	Relative mouse movement in y-direction.
	*/
	void cameraLookAround(float mouseRotX, float mouseRotY);

private:
	/**
	*	@brief The node used for yaw.
	*/

	Ogre::SceneNode* m_yawNode;
	/**
	*	@brief The node used for pitch.
	*/

	Ogre::SceneNode* m_pitchNode;
	/**
	*	@brief The node used for roll. This is the node that the camera should be attached to.
	*/
	Ogre::SceneNode* m_rollNode;
};

#endif